/** Returns the value representing the day of the week for the given date
 * (month, day, year), where 0 denotes Sunday, 1 denotes Monday, ...,
 * and 6 denotes Saturday.
 * Precondition: The date represented by month, day, year is a valid date. 
 */
public static int dayOfWeek(int month, int day, int year)
{
    int date = 0;
    date = firstDayOfYear(year) + dayOfYear(month, day, year) - 1;
    return date % 7;

}